namespace SinaFinanceBaseClassLibrary
{
    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;

    public class IntersectionPointInfoArea
    {
        private string dateTime = string.Empty;
        private Canvas parentCanvas = new Canvas();
        private string price = string.Empty;
        private string stockId = string.Empty;
        private string stockName = string.Empty;
        private TextBlock tblDateTime = new TextBlock();
        private TextBlock tblPrice = new TextBlock();
        private TextBlock tblStockId = new TextBlock();
        private TextBlock tblStockName = new TextBlock();
        private TextBlock tblVolumn = new TextBlock();
        private string volumn = string.Empty;

        public void AppendIntersectionPointInfoArea()
        {
            this.RenderInfoItem(this.tblStockId, "代码：", this.stockId, new Thickness(this.tblStockName.ActualWidth + 40.0, 0.0, 0.0, 0.0));
            this.RenderInfoItem(this.tblDateTime, "时间：", this.dateTime, new Thickness((this.tblStockName.ActualWidth + this.tblStockId.ActualWidth) + 60.0, 0.0, 0.0, 0.0));
            this.RenderInfoItem(this.tblPrice, "价格：", this.price, new Thickness(((this.tblStockName.ActualWidth + this.tblStockId.ActualWidth) + this.tblDateTime.ActualWidth) + 70.0, 0.0, 0.0, 0.0));
            this.RenderInfoItem(this.tblVolumn, "成交量：", this.volumn, new Thickness((((this.tblStockName.ActualWidth + this.tblStockId.ActualWidth) + this.tblDateTime.ActualWidth) + this.tblPrice.ActualWidth) + 80.0, 0.0, 0.0, 0.0));
        }

        public void RemoveIntersectionPointInfoArea()
        {
            this.parentCanvas.Children.Remove(this.tblStockName);
            this.parentCanvas.Children.Remove(this.tblStockId);
            this.parentCanvas.Children.Remove(this.tblDateTime);
            this.parentCanvas.Children.Remove(this.tblPrice);
            this.parentCanvas.Children.Remove(this.tblVolumn);
        }

        protected void RenderInfoItem(TextBlock tbl, string title, string Info, Thickness thickness)
        {
            tbl.Text = title + Info;
            tbl.Foreground = new SolidColorBrush(Colors.White);
            tbl.Margin = thickness;
            this.parentCanvas.Children.Add(tbl);
        }

        public string DateTime
        {
            get
            {
                return this.dateTime;
            }
            set
            {
                this.dateTime = value;
            }
        }

        public Canvas ParentCanvas
        {
            get
            {
                return this.parentCanvas;
            }
            set
            {
                this.parentCanvas = value;
            }
        }

        public string Price
        {
            get
            {
                return this.price;
            }
            set
            {
                this.price = value;
            }
        }

        public string StockId
        {
            get
            {
                return this.stockId;
            }
            set
            {
                this.stockId = value;
            }
        }

        public string StockName
        {
            get
            {
                return this.stockName;
            }
            set
            {
                this.stockName = value;
            }
        }

        public string Volumn
        {
            get
            {
                return this.volumn;
            }
            set
            {
                this.volumn = value;
            }
        }
    }
}
